<?php
/**
*	上传的文件
*/
namespace Rainrock\Framework\Chajian;


use Rainrock\Framework\kernel\core\Chajian;
use Rainrock\Framework\kernel\base\Base;
use Rainrock\Framework\kernel\base\Jiami;
use Rainrock\Framework\kernel\base\Auth;


class rockfileChajian extends Chajian{
	
	private $rockfile_url,$rockfile_key;
	
	public function initChajian()
	{
		$this->rockfile_url 	 = Base::getConfig('rockfile_url');
		$this->rockfile_key 	 = Base::getConfig('rockfile_key');
		if($this->rockfile_url && substr($this->rockfile_url,-1)!='/')$this->rockfile_url.='/';
	}
	
	/**
	*	引入文件地址
	*/
	public function importurl()
	{
		if(!$this->rockfile_url || !$this->rockfile_key)return '';
		
		$optid 	 = Auth::$USERID;
		$optname = Auth::$NAME;
		$optface = Auth::getUserInfo('face');
		$url = ''.$this->rockfile_url.'index.php?m=filejs&a=base&key='.$this->rockfile_key.'&optid='.$optid.'';
		if($optname)$url.='&optname='.Jiami::base64encode($optname).'';
		if($optface){
			if(substr($optface, 0, 4)!='http')$optface = ''.URLN.$optface.'';
			$url.='&optface='.Jiami::base64encode($optface).'';
		}
		return $url;
	}
}